﻿// ===================================
// <copyright>
// This file is part of LABSMFController.
//
//    LABSMFController is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    LABSMFController is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with LABSMFController.  If not, see <http://www.gnu.org/licenses/>.
//    Copyright 2011 David Bakker
//
//</copyright>
// <author>David Bakker</author>
// <email>mailto:DavidFBakker@gmail.com</email>
// <created>Saturday, May 07, 2011</created>
// <lastedit>Saturday, May 07, 2011</lastedit>
// ===================================

using System;
using System.Reflection;
using LABSMFControllerMFCobra.Modules;
using Microsoft.SPOT.Presentation.Controls;

namespace LABSMFController.UI
{
    public class ModulesCanvas : Canvas
    {
        public void AddModule(Type modtype)
        {
            ConstructorInfo modConstruct = modtype.GetConstructor(new Type[] {});

            var w = (UIModules) modConstruct.Invoke(null);
            w.Configure();


            Children.Add(w);

            SetLeft(w, GetLeft(this));
            SetTop(w, GetRight(this));
        }
    }
}